set more off

************************************************************************************************************
****************************************Table S.2***********************************************************
************************************************************************************************************

local rloop = 250


local alpha = 1
local sigma = 1
local sigmax = 1
local N = 20000
local beta=1
local loopcount = 0


*DGP index
*1 == Weitzman
*2 == Directed Cognition
*3 == Satisficing
*4 == Search all goods above a threshold
*5 == Random search


local dgplist = "1 2 3 4"

local Jlist = "2 3 5 10"


forvalues r = 1/`rloop' {

foreach dgp of local dgplist {

foreach J of local Jlist {
	
local loopcount = `loopcount'+1
display "LOOP START!"
display "LOOP START!"
display "LOOP START!"
display "LOOP START!"
display "r is `r'"
display "dgp is `dgp'"
display "J is `J'"

set seed 600`r'

do programs/flexiblelogit.do `alpha' `beta' `sigma' `sigmax' `J'  `N' `dgp' 

gen r = `r'
if(`loopcount' > 1) append using simtable
save simtable, replace
}
}
}



use simtable,clear
sort dgp J r
gen naivelogitsd = naivelogit
gen theoryratsd = theoryrat
collapse (mean) naivelogit theoryrat (sd) naivelogitsd theoryratsd , by(dgp J)
rename (dgp J naivelogit theoryrat naivelogitsd theoryratsd)(DGP Number_of_Goods Standard Flexible Standard_sd Flexible_sd)
label var Standard "Standard Logit point estimate"
label var Flexible "Flexible Logit point estimate"
label var Standard_sd "Standard Logit standard deviation"
label var Flexible_sd "Flexible Logit standard deviation"

